;Exercise 1.7
;Falha para o número 1e50 com a forma original
;Resultado péssimo para 0.00000000001 -> 0.03125

(define (sqrt-iter guess previous_guess x)
  (if (good-enough? guess previous_guess)
      guess
      (sqrt-iter (improve guess x) guess
                 x)))

(define (improve guess x)
  (average guess (/ x guess)))

(define (average x y)
  (/ (+ x y) 2))

(define (good-enough? guess previous_guess)
  (< (abs (- previous_guess guess)) (abs (* 0.0000000000001 guess))))

(define (sqrt x)
  (sqrt-iter 1.0 2.0 x))

;A forma nova funciona melhor para números grandes
